//导入要处理的组件
import main from './MainView'
//导入vue
import Vue from 'vue'
//生成构造器
let Message = Vue.extend(main)

const ConfirmBox = (obj) => {
    return new Promise((resolve, reject) => {
        //定义取消和确定的俩个函数体
        //取消
        const cancelCallback = () => {
            reject()
            document.body.removeChild(msg.$el)
        }
        //确定
        const confirmCallback = () => {
            resolve()
            document.body.removeChild(msg.$el)
        }
        let newobj = { ...obj, cancelCallback, confirmCallback }
        //调用构造器将在调用的参数传入
        let msg = new Message({ data: newobj })
        //将用构造器生成对象挂载
        msg.$mount()
        //将dom元素插入到页面
        document.body.appendChild(msg.$el)
    })
    //定义多久消失 

}
export default ConfirmBox
